What is the proper way to define a class when a function is an optional parameter